package com.tanklab.signature.common.Enum;

public enum ActionEnum {
    REJECT("reject"),
    APPROVE("approve");

    private final String value;
    private final int code;

    // 构造函数
    ActionEnum(String value) {
        this.value = value;
        switch (value){
            case "reject":this.code=-1;break;
            case "approve":this.code=1;break;
            default:this.code=0;break;
        }
    }

    public String getValue() {
        return value;
    }

    public int getCode() {
        return code;
    }

    // 根据字符串值获取对应的枚举
    public static ActionEnum fromValue(String value) {
        for (ActionEnum status : ActionEnum.values()) {
            if (status.value.equalsIgnoreCase(value)) {
                return status;
            }
        }
        throw new IllegalArgumentException("Unknown value: " + value);
    }
}
